package kassiopeia.commons.model.xml;

import kassiopeia.commons.model.Coordinates;
import kassiopeia.commons.model.task.Connection;
import kassiopeia.commons.model.task.ParameterInstance;
import kassiopeia.commons.model.task.PluginInstance;
import kassiopeia.commons.model.task.TaskDescriptor;

import com.thoughtworks.xstream.XStream;

public final class TaskDescriptorXmlSerializer {

    private static XStream xstream = new XStream();

    private TaskDescriptorXmlSerializer() {}

    static {
        xstream.processAnnotations(new Class[]{Connection.class,TaskDescriptor.class,
                ParameterInstance.class,PluginInstance.class,Coordinates.class});
    }

    public static TaskDescriptor fromXml(String xml) {
        return (TaskDescriptor)xstream.fromXML(xml);
    }

    public static String toXml(TaskDescriptor task) {
        return xstream.toXML(task);
    }
}

